package com.pengpeng.zookeeper.lock;

/**
 * @author 彭鹏
 * @date 2021/10/21.
 */
public class UnLockOrderService implements Runnable {

    private OrderNumGenerator orderNumGenerator = new OrderNumGenerator(); //定义成全局的

    @Override
    public void run() {
        getNumber();
    }

    public void getNumber() {
        String number = orderNumGenerator.getNumber();
        System.out.println(Thread.currentThread().getName() + "num" + number);
    }

    public static void main(String[] args) {
        UnLockOrderService orderService = new UnLockOrderService();
        for (int i = 0; i < 100; i++) {  //开启100个线程
            new Thread(orderService).start();
        }
    }

}
